#ifndef CAMERA
#define CAMERA

#include "frustum.h"
#include "../physics/physics.h"
#include "../core/device/event.h"

namespace sleek
{
    namespace core
    {
        namespace device
        {
            class Device;
        }
    }
    namespace node
    {
        namespace camera
        {
            enum CAMERA_VIEW_MODE
            {
                CVM_ORTHOGRAPHIC,
                CVM_PERSPECTIV,
                CVM_COUNT
            };
            class Camera : public core::engine::reference
            {
                public:
                    Camera(core::device::Device*);
                    virtual ~Camera();

                    virtual void setFovValue(core::f32);
                    virtual void setFarValue(core::f32);
                    virtual void setNearValue(core::f32);
                    virtual void setAspectRatio(core::f32);

                    virtual void setViewMode(CAMERA_VIEW_MODE);
                    virtual void setTarget(core::math::vector3df);
                    virtual void setPosition(core::math::vector3df);
                    virtual void setRotation(core::math::vector3df);
                    virtual void setViewPort(core::math::aabbox2di);

                    virtual core::math::aabbox2di getViewPort();
                    virtual core::math::vector3df getPosition();
                    virtual core::math::vector3df getRotation();
                    virtual core::math::vector3df getTarget();
                    virtual CAMERA_VIEW_MODE getViewMode();

                    virtual Frustum* getViewFrustum();

                    virtual core::f32 getAspectRatio();
                    virtual core::f32 getNearValue();
                    virtual core::f32 getFarValue();
                    virtual core::f32 getFovValue();

                    virtual bool manage(core::device::input*);
                    virtual void update();
                    virtual void render();
                protected:
                    Frustum *frust;
                    core::device::Device *screen;
                    core::f32 fars, nears, fovs, asps;
                    core::math::vector3df pos, rot, tar;
                    core::math::vector3df eye, cen, up;
                    core::math::aabbox2di viewport;
                    CAMERA_VIEW_MODE mode;
                    virtual void updateLookAtVector();
            };
        }
    }
}

#endif
